﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Ext.Net;
using System.Web.Security;

namespace ExamAnalysis.Account
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void LoginButton_Click(object sender, DirectEventArgs e)
        {
            bool isok = Membership.ValidateUser(UserName.Text, Password.Text);

            if (isok)
            {
                if (Request.QueryString["ReturnUrl"] != null)
                {
                    FormsAuthentication.SetAuthCookie(UserName.Text, false);
                    X.Redirect(Request.QueryString["ReturnUrl"]);
                }

                else
                {
                    FormsAuthentication.SetAuthCookie(UserName.Text, false);
                    X.Redirect(FormsAuthentication.DefaultUrl);
                }
            }
            else
            {
                X.Msg.Alert("用户登录", "登录失败").Show();
            }
        }
    }
}